package 常用类.Array类.list.List课堂案例;

public class UserTest {
    public static void main(String[] args) throws Exception {
        UserOperate userOperate = new UserOperate();
        //添加10名用户
        for (int i = 0; i < 10; i++) {
            User user = new User();
            user.setUserId(i+1);
            user.setUsername("小明"+i);
            user.setAge(20+i);
            user.setPassword("88888888"+i);
            user.setEmail(i+"3333@.com");
            userOperate.addUser(user);
        }
        //查看用户列表
        userOperate.queryAll();
        System.out.println("-------根据用户编号查看用户信息-------");
        User user=userOperate.getUserId(5);
        System.out.println(user==null?"用户不存在":user);

        //删除用户
        System.out.println("-------根据用户编号删除用户-------");
        userOperate.deleteUserId(4);
        userOperate.queryAll();

        //修改用户
        System.out.println("-------根据用户编号修改用户信息-------");
        User user2 = new User();
        user2.setUserId(2);
        user2.setAge(30);
        user2.setUsername("小花");
        user2.setPassword("99999999");
        user2.setEmail("6666@.com");
        userOperate.upDateUser(user2);
        User user1 = userOperate.getUserId(2);
        System.out.println(user1);
    }
}
